using System;
using System.Diagnostics;
using System.IO;

namespace Mindless
{
    public class Settings
    {
        /// <summary>
        /// Number of cards in a hand.
        /// </summary>
        public const int HandSize = 6;

        /// <summary>
        /// Number of players in the game.
        /// </summary>
        public const int PlayerCount = 4;

        /// <summary>
        /// Number of teams in the game.
        /// </summary>
        public const int TeamCount = 2;

        /// <summary>
        /// Number of suits in the deck.
        /// </summary>
        public const int SuitCount = 4;

        /// <summary>
        /// Number of cards in a suit.
        /// </summary>
        public const int RankCount = 13;

        /// <summary>
        /// Number of points needed to win a game.
        /// </summary>
        public const int GameThreshold = 11;

        /// <summary>
        /// Number of seconds permitted to simulate deals per evaluation.
        /// </summary>
        // public const int DealEvaluationTime = 2;

        public const int DealEvaluations = 100;

        public const int Lookahead = 8;

        /// <summary>
        /// Seed value for random number generator.
        /// </summary>
#if DEBUG
        public static int Seed = 0;
#else
        public static int Seed = (int) DateTime.Now.Ticks;
#endif

        /// <summary>
        /// Random number generator.
        /// </summary>
        protected static Random rng = new Random(Seed);
        public static void InitRNG(int seed)
        {
            rng = new Random(seed);
        }
        public static int NextRandom()
        {
            lock (rng)
            {
                return rng.Next();
            }
        }
        public static int NextRandom(int maxValue)
        {
            lock (rng)
            {
                return rng.Next(maxValue);
            }
        }

        static Settings()
        {
            Debug.Assert(PlayerCount % TeamCount == 0);
            Debug.Assert(TeamCount > 1);
            Debug.Assert(TeamCount <= PlayerCount);
        }
    }
}
